<?php
/**
 * @author sky
 * @date 2021/4/17  15:35
 */
namespace App\Tools\Services;

class JsonService
{
    private static $SUCCESS_DEFAULT_MSG='ok';
    private static $FAIL_DEFAULT_MSG='no';

    public static function result($code,$msg = '',$data = [],$count=0)
    {
        exit(json_encode(compact('code','msg','data','cunt')));
    }

    public static function  fail($msg,$data=[],$code=400)
    {
        if(true == is_array($msg)){
            $data = $msg;
            $msg = self::$FAIL_DEFAULT_MSG;
        }
        return self::result($code,$msg,$data);
    }
}
